package com.flashflexpro.flexdirector.model {
import com.flashflexpro.flexdirector.constant.DirectorMetadata;

/**
 * abstract
 * 
 */
[Bindable]
[RemoteClass]
public class DtoActionReplay extends DtoAction implements IProcedureChild{

    public function DtoActionReplay(){
        name = "Unnamed replay action";
    }

    override public function getId():String{
        return replayProcedure.getId() + replayProcedure.children.getItemIndex( this );
    }
    //temp for debugging.
    public var errors:Array;
    

    public var replayProcedure:DtoTestProcedure;
    public var retryNum:int = 3;
    public var exitOnFailure:Boolean = false;




    override public function copyInto ( parent:NameAndComment, newType:Class ):NameAndComment {
        var rt:DtoActionReplay = super.copyInto ( parent, DtoActionReplay ) as DtoActionReplay;
        rt.retryNum = retryNum;
        rt.exitOnFailure = exitOnFailure;
        rt.replayProcedure = parent as DtoTestProcedure;
        rt.appInst = appInst;
        return rt;
    }

    override public function destroy():void {
        replayProcedure = null;
        super.destroy();
    }

    public function getCodeStepType():String {
        if( input != null ){
            return DirectorMetadata.metaStepTypeInput;
        }
        else if( check != null ){
            return DirectorMetadata.metaStepTypeCheck;
        }
        else if( edge < 0 ){
            return DirectorMetadata.metaExist;
        }
        else{
            throw new Error( this + ".getCodeStepType No!" );
        }
    }
}
}